package cn.fintecher.pangolin.entity.mysql;

import cn.fintecher.pangolin.common.enums.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;
import java.util.Set;

/**
 * @Author wangxiangdong
 * @Description 流程申请
 * @Date 2019/9/26 14:01
 **/
@Data
@Entity
@Table(name = "process_application")
@ApiModel(value = "process_application", description = "流程申请")
public class ProcessApplication extends BaseEntity{

    @ApiModelProperty("案件ID")
    private String caseId;

    @ApiModelProperty("批次号")
    private String batchNumber;

    @ApiModelProperty("案件编号")
    private String caseNumber;

    @ApiModelProperty("客户姓名")
    private String personalName;

    @ApiModelProperty("客户姓名")
    private String personalId;

    @ApiModelProperty("委托方名称")
    private String principalName;

    @ApiModelProperty("委托方名称")
    private String principalId;

    @ApiModelProperty("身份证号码")
    private String certificateNo;

    @ApiModelProperty(notes = "留案到期日期")
    private Date endCaseDate;

    @ApiModelProperty(notes = "委案金额")
    private Double overdueAmtTotal;

    @ApiModelProperty(notes = "欠款金额")
    private Double leftAmt;

    @ApiModelProperty("申请人姓名")
    private String applyName;

    @ApiModelProperty("申请人")
    private String applyId;

    @ApiModelProperty("申请时间")
    private Date applyDate;

    @ApiModelProperty("申请说明")
    private String applyRemark;

    @ApiModelProperty("申请类型")
    @Enumerated(EnumType.STRING)
    private FlowType flowType;

    @ApiModelProperty("审批状态")
    @Enumerated(EnumType.STRING)
    private ApprovalStage approvalStage = ApprovalStage.WAIT_APPROVAL;

    @ApiModelProperty("材料Id")
    private String fileId;

    @ApiModelProperty("申请减免金额")
    private Double derateAmount;

    @ApiModelProperty("实际减免金额")
    private Double derateRealAmount;

    @ApiModelProperty("申调资料类型")
    @Enumerated(EnumType.STRING)
    private ApplyFileContent applyContent;

    @ApiModelProperty("申调资料部门")
    private String applyFileDepartId;

    @ApiModelProperty("申调地区名称")
    private String applyFileDepartName;

    @ApiModelProperty("导出状态")
    @Enumerated(EnumType.STRING)
    private ExportState exportState = ExportState.WAIT_EXPORT;

    @ApiModelProperty(value = "审批节点")
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "flow_config_id")
    @JsonIgnore
    private Set<ProcessFlowNode> processFlowNodes;

    /**  协催申请信息 **/
    @ApiModelProperty("协催地址")
    private String addressDetail;

    @ApiModelProperty("地址类型")
    private String addressType;

    @ApiModelProperty("关系")
    private String relation;

    @ApiModelProperty("外访开始时间")
    private Date visitTimeStart;

    @ApiModelProperty("外访开始时间")
    private Date visitTimeEnd;

    @ApiModelProperty("地址Id")
    private String personalAddressId;

    @ApiModelProperty("联系电话Id")
    private String personalContactId;

    @ApiModelProperty("催收员姓名")
    private String collectorName;

    @ApiModelProperty("催收员ID")
    private String collectorId;

    @ApiModelProperty("信函模板ID")
    private String letterTempId;

    @ApiModelProperty("操作人")
    private String operator;

    @ApiModelProperty("操作时间")
    private Date operatorDate;


    @Override
    public int hashCode() {

        return Objects.hash(super.hashCode(), caseId, batchNumber, personalName, personalId, principalName, principalId, certificateNo, applyName, applyId, applyDate, applyRemark, flowType, approvalStage, fileId, derateAmount, derateRealAmount, applyContent, applyFileDepartId, applyFileDepartName, exportState, addressDetail, addressType, relation, personalAddressId, personalContactId, collectorName, collectorId, letterTempId, operator, operatorDate);
    }
}
